package com.carter.springframework.beans.factory.support;

import com.carter.springframework.core.io.DefaultResourceLoader;
import com.carter.springframework.core.io.ResourceLoader;

/**
 * bean定义读取接口的抽象类，实现了两个工具类方法
 */
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader{
    private final BeanDefinitionRegistry registry;

    private final ResourceLoader resourceLoader;

    protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry){
        this(registry,new DefaultResourceLoader());
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry(){
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader(){
        return resourceLoader;
    }
}
